{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from XlementFitting import SingleCycleFitting2, convert_json_to_excel_single_cycle, FittingOptions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "起始点:[[1.5, 6, -2], [1.5, 4, -4], [150, 4, -2], [1500, 4, 0]]\n",
      "精确度:1.0000e-06\n",
      "惩罚区:[-20.0,40]\n",
      "惩罚强度:1.0\n",
      "KD限:-12.0\n",
      "惩罚率:1.0\n"
     ]
    }
   ],
   "source": [
    "from XlementFitting import PartialBivariate, LocalBivariate, GlobalBivariate\n",
    "file_path = \"SourceData/多循环动力学/ass-biv2.xlsx\" # 输入文件路径\n",
    "custom_options = FittingOptions()\n",
    "custom_options.set_init_params([\n",
    "    [1.5,6,-2],\n",
    "    [1.5,4,-4],\n",
    "    [150,4,-2],\n",
    "    [1500,4,0]\n",
    "])\n",
    "custom_options.set_punish_k(1.0)\n",
    "custom_options.set_KD_bound(-12)\n",
    "custom_options.set_punish_lower(-20)\n",
    "print(custom_options)\n",
    "r,p,i = PartialBivariate(\n",
    "    file_path,\n",
    "    time0=100,\n",
    "    options=custom_options,\n",
    "    write_file=True,\n",
    "    save_png=True,\n",
    "    excel_path=\"FittingResultFile\",\n",
    "    png_path=\"FittingPlots\") # 全局拟合\n",
    "r,p,i = LocalBivariate(\n",
    "    file_path,\n",
    "    time0=100,\n",
    "    options=custom_options,\n",
    "    write_file=True,\n",
    "    save_png=True,\n",
    "    excel_path=\"FittingResultFile\",\n",
    "    png_path=\"FittingPlots\") # 全局拟合\n",
    "r,p,i = GlobalBivariate(\n",
    "    file_path,\n",
    "    time0=100,\n",
    "    options=custom_options,\n",
    "    write_file=True,\n",
    "    save_png=True,\n",
    "    excel_path=\"FittingResultFile\",\n",
    "    png_path=\"FittingPlots\") # 全局拟合"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ImgProcess",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
